//
//  MXFaceRecgnitionCell.m
//  MXLoginMethodsDomo
//
//  Created by 马彦 on 16/10/11.
//  Copyright © 2016年 MX. All rights reserved.
//

#import "MXFaceRecgnitionCell.h"

@interface MXFaceRecgnitionCell ()

/**
 标题
 */
@property (nonatomic, strong) UILabel *titleLbl;
/**UIswitch*/
@property (nonatomic, strong) UISwitch *fingerprintSwitch;

@end

@implementation MXFaceRecgnitionCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self configureUI];
    }
    return self;
}


- (void)configureUI {
    UILabel *titleLbl = [[UILabel alloc] init];
    titleLbl.textColor = [UIColor blackColor];
    titleLbl.font = [UIFont systemFontOfSize:14];
    [self.contentView addSubview:titleLbl];
    self.titleLbl = titleLbl;
    
    UISwitch *fingerprintSwitch = [[UISwitch alloc] init];
    fingerprintSwitch.tintColor = RGBA_Color(0.75, 0.75, 0.75, 1.0);
    fingerprintSwitch.onTintColor = RGBA_Color(0.55, 0.40, 0.78, 1.0);
    [fingerprintSwitch addTarget:self action:@selector(fingerprintSwitchOnAction:) forControlEvents:UIControlEventValueChanged];
    self.accessoryView = fingerprintSwitch;
    self.fingerprintSwitch = fingerprintSwitch;
}



- (void)fingerprintSwitchOnAction:(UISwitch *)swit {
    
    if ([_delegate respondsToSelector:@selector(faceRecgnitionWithSwitch:)]) {
        [_delegate faceRecgnitionWithSwitch:swit];
    }
   
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    [self.titleLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.centerY.mas_equalTo(self.mas_centerY);
        make.height.mas_equalTo(14);
    }];
    
}

-(void)setTitleStr:(NSString *)titleStr {
    self.titleLbl.text = titleStr;
    
    
}

@end
